package day9.Exer;

import java.io.*;
import java.util.Iterator;

public class Exer5 {
    public static void main(String[] args) {
        BufferedReader br = null;
        BufferedWriter bw = null;
        try {
            br = new BufferedReader(new FileReader("E:\\作业\\chaoxian.txt"));
            StringBuffer sb=new StringBuffer();
            String str ;
            while ((str = br.readLine()) != null) {
                br.readLine();
                sb.append(str+"\n");
            }
            String str2=sb.toString();
            str2=str2.replaceAll("金正恩","金三胖");
            bw=new BufferedWriter(new FileWriter("E:\\作业\\chaoxian.txt"));
            bw.write(str2);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            if(br!=null){
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if(bw!=null){
                try {
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
